﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MengLin.OOP.DesignPattern.State.TrafficLights
{
    public class TrafficLight
    {
        public LightColor Color { get; set; }

        public void Show()
        {
            Console.WriteLine("绿灯行");
        }

        /// <summary>
        /// 灯的颜色改变
        /// </summary>
        public  void Change()
        {
            if(Color == LightColor.Green)
            {
                Color = LightColor.Yellow;
            }
            else if(Color == LightColor.Yellow)
            {
                Color = LightColor.Red;
            }
            else if (Color == LightColor.Red)
            {
                Color = LightColor.Green;
            }
        }
    }
}
